// Pipeline Component Library Example
// ----------------------------------
// Colin Bowern (colinbowern@hotmail.com)
// January 2007
//
// Copyright (c) 2007 Colin Bowern
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// * The above copyright notice and this permission notice shall be included in
//   all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#region References
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Globalization;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
#endregion

namespace RockstarGuys.PipelineComponents
{
    /// <remarks />
    public partial class AboutPanel : UserControl
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AboutPanel"/> class.
        /// </summary>
        public AboutPanel()
        {
            InitializeComponent();

            this.ProductNameLabel.Text = this.ProductName;
            this.ProductVersionLabel.Text = String.Format(CultureInfo.CurrentUICulture, "Version {0}", this.ProductVersion);
            this.ProductCopyrightLabel.Text = AssemblyCopyright;
            this.CompanyNameLabel.Text = this.CompanyName;
            this.ProductDescriptionLabel.Text = AssemblyDescription;
        }

        /// <summary>
        /// Gets the assembly description.
        /// </summary>
        /// <value>The assembly description.</value>
        public string AssemblyDescription
        {
            get
            {
                string value = string.Empty;
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
                if (attributes.Length > 0)
                {
                    AssemblyDescriptionAttribute attribute = (AssemblyDescriptionAttribute)attributes[0];

                    if (!string.IsNullOrEmpty(attribute.Description))
                    {
                        value = attribute.Description;
                    }
                }
                return value;
            }
        }

        /// <summary>
        /// Gets the assembly product.
        /// </summary>
        /// <value>The assembly product.</value>
        public string AssemblyProduct
        {
            get
            {
                string value = string.Empty;
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
                if (attributes.Length > 0)
                {
                    AssemblyProductAttribute attribute = (AssemblyProductAttribute)attributes[0];

                    if (!string.IsNullOrEmpty(attribute.Product))
                    {
                        value = attribute.Product;
                    }
                }
                return value;
            }
        }

        /// <summary>
        /// Gets the assembly copyright.
        /// </summary>
        /// <value>The assembly copyright.</value>
        public string AssemblyCopyright
        {
            get
            {
                string value = string.Empty;
                object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
                if (attributes.Length > 0)
                {
                    AssemblyCopyrightAttribute attribute = (AssemblyCopyrightAttribute)attributes[0];

                    if (!string.IsNullOrEmpty(attribute.Copyright))
                    {
                        value = attribute.Copyright;
                    }
                }
                return value;
            }
        }
    }
}
